﻿<Window x:Class="iMagistic.MainForm"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:iMagistic"
    xmlns:res="clr-namespace:iMagistic.Properties"
    Title="Image processor" Height="677" Width="1000"
    WindowStartupLocation="CenterScreen" ResizeMode="CanResize" WindowState="Normal" WindowStyle="None" MinWidth="782" MinHeight="656" Drop="Window_Drop" AllowDrop="True" DragEnter="Window_DragEnter" Icon="/iMagistic;component/images/icon.ico" KeyDown="Window_KeyDown" KeyUp="Window_KeyUp" Loaded="Window_Loaded" SizeChanged="Window_SizeChanged">
    <Window.Background>
        <ImageBrush ImageSource="/iMagistic;component/images/black_bgrd.png" Stretch="Fill" TileMode="Tile" Viewport="0,0,149,149" ViewportUnits="Absolute" />
    </Window.Background>

    <Window.Resources>


        <SolidColorBrush x:Key="CustomBrush1" Color="#CCB2DE" />
        <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />
        <SolidColorBrush x:Key="WindowBackgroundBrush" Color="#FFF" />
        <SolidColorBrush x:Key="NormalForegroundBrush" Color="Black" />
        <LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
            <GradientBrush.GradientStops>
                <GradientStopCollection>
                    <GradientStop Color="#CCC" Offset="0.0"/>
                    <GradientStop Color="#444" Offset="1.0"/>
                </GradientStopCollection>
            </GradientBrush.GradientStops>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
            <GradientBrush.GradientStops>
                <GradientStopCollection>
                    <GradientStop Color="#CCC" Offset="0.0"/>
                    <GradientStop Color="#444" Offset="1.0"/>
                </GradientStopCollection>
            </GradientBrush.GradientStops>
        </LinearGradientBrush>
        <SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
        <SolidColorBrush x:Key="SolidBorderBrush" Color="#888" />
        <SolidColorBrush x:Key="LightBorderBrush" Color="#AAA" />
        <SolidColorBrush x:Key="GlyphBrush" Color="#444" />
        <ControlTemplate TargetType="ToggleButton" x:Key="ComboBoxToggleButtonTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="30" />
                </Grid.ColumnDefinitions>
                <Border
          BorderBrush="Black"
          CornerRadius="2,2,2,2"
          BorderThickness="1,1,1,1"
          Name="Border"
          Background="WhiteSmoke"
          Grid.ColumnSpan="2" />
                <Border
          Margin="1,1,1,1"
          BorderBrush="{StaticResource NormalBorderBrush}"
          CornerRadius="2,0,0,2"
          BorderThickness="0,0,1,0"
          Background="LightGray"
          Grid.Column="0" />
                <Path
          Margin="0,0,3,0"
          Data="M0,0L4,4 8,0z"
          HorizontalAlignment="Center"
          Fill="{StaticResource GlyphBrush}"
          Name="Arrow"
          VerticalAlignment="Center"
          Width="8"
          Grid.Column="1" />
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="UIElement.IsMouseOver" Value="True">
                    <Setter Property="Panel.Background" TargetName="Border" Value="WhiteSmoke"/>
                </Trigger>
                <Trigger Property="ToggleButton.IsChecked" Value="True">
                    <Setter Property="Panel.Background" TargetName="Border" Value="WhiteSmoke"/>
                    <Setter Property="Shape.Fill" TargetName="Arrow" Value="#FF8D979E"/>
                </Trigger>
                <Trigger Property="UIElement.IsEnabled" Value="False">
                    <Setter Property="Panel.Background" TargetName="Border" Value="{StaticResource DisabledBackgroundBrush}"/>
                    <Setter Property="Border.BorderBrush" TargetName="Border" Value="{StaticResource DisabledBorderBrush}"/>
                    <Setter Property="TextElement.Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                    <Setter Property="Shape.Fill" TargetName="Arrow" Value="#66FFFFFF"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <ControlTemplate TargetType="TextBox" x:Key="ComboBoxTextBoxTemplate">
            <Border
        Name="PART_ContentHost"
        Background="AliceBlue"
        Focusable="False" />
        </ControlTemplate>
        <Style TargetType="{x:Type ComboBoxItem}">
            <Setter Property="UIElement.SnapsToDevicePixels" Value="True"/>
            <Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="TextElement.Foreground"  Value="{StaticResource NormalForegroundBrush}"/>
            <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True"/>
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                        <Border
              Name="Border"
              SnapsToDevicePixels="True"
              Padding="2,2,2,2">
                            <ContentPresenter
                ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
                Content="{TemplateBinding ContentControl.Content}" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="ComboBoxItem.IsHighlighted" Value="True">
                                <Setter Property="Panel.Background" TargetName="Border" Value="{StaticResource CustomBrush1}"/>
                            </Trigger>
                            <Trigger Property="UIElement.IsEnabled" Value="False">
                                <Setter Property="TextElement.Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type ComboBox}">
            <Setter Property="UIElement.SnapsToDevicePixels" Value="True"/>
            <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True"/>
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
            <Setter Property="TextElement.Foreground" Value="{StaticResource NormalForegroundBrush}"/>
            <Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ComboBox">
                        <Grid>
                            <ToggleButton
                                ClickMode="Press"
                                Name="ToggleButton"
                                IsChecked="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                                Focusable="False"
                                Grid.Column="2"
                                Template="{StaticResource ComboBoxToggleButtonTemplate}"/>
                            <ContentPresenter
                                Margin="3,3,23,3"
                                HorizontalAlignment="Left"
                                Name="ContentSite"
                                VerticalAlignment="Center"
                                ContentTemplate="{TemplateBinding ComboBox.SelectionBoxItemTemplate}"
                                Content="{TemplateBinding ComboBox.SelectionBoxItem}"
                                IsHitTestVisible="False" />
                            <TextBox
                                Margin="3,3,23,3"
                                Visibility="Hidden"
                                HorizontalAlignment="Left"
                                Name="PART_EditableTextBox"
                                Background="Transparent"
                                VerticalAlignment="Center"
                                Style="{x:Null}"
                                IsReadOnly="False"
                                Focusable="True"
                                  xml:space="preserve"
                    Template="{StaticResource ComboBoxTextBoxTemplate}"/>
            <Popup
                Placement="Bottom"
                Name="Popup"
                Focusable="False"
                AllowsTransparency="True"
                IsOpen="{TemplateBinding ComboBox.IsDropDownOpen}"
                PopupAnimation="Fade">
              <Grid
                  MinWidth="{TemplateBinding FrameworkElement.ActualWidth}"
                  MaxHeight="{TemplateBinding ComboBox.MaxDropDownHeight}"
                  Name="DropDown"
                  SnapsToDevicePixels="True">
                <Border
                    BorderBrush="{StaticResource NormalBorderBrush}"
                    BorderThickness="1,1,1,1"
                    Name="DropDownBorder"
                    Background="{StaticResource WindowBackgroundBrush}"/>
                <ScrollViewer
                    Margin="1,6,1,6"
                    SnapsToDevicePixels="True">
                  <ItemsPresenter
                      KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
              </Grid>
            </Popup>
          </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="ItemsControl.HasItems" Value="False">
                                <Setter Property="FrameworkElement.MinHeight" TargetName="DropDownBorder" Value="95"/>
                            </Trigger>
                            <Trigger Property="UIElement.IsEnabled" Value="False">
                                <Setter Property="TextElement.Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                            </Trigger>
                            <Trigger Property="ItemsControl.IsGrouping" Value="True">
                                <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                            </Trigger>
                            <Trigger Property="Window.AllowsTransparency" SourceName="Popup" Value="True">
                                <Setter Property="Border.CornerRadius" TargetName="DropDownBorder" Value="4"/>
                                <Setter Property="FrameworkElement.Margin" TargetName="DropDownBorder" Value="0,2,0,0"/>
                            </Trigger>
                            <Trigger Property="ComboBox.IsEditable" Value="True">
                                <Setter Property="KeyboardNavigation.IsTabStop" Value="False"/>
                                <Setter Property="UIElement.Visibility" TargetName="PART_EditableTextBox" Value="Visible"/>
                                <Setter Property="UIElement.Visibility" TargetName="ContentSite" Value="Hidden"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <!-- Focus Visual -->

        <Style x:Key="RadioButtonFocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border>
                            <Rectangle 
              Margin="15,0,0,0"
              StrokeThickness="1"
              Stroke="#60000000"
              StrokeDashArray="1 2"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
            <GradientBrush.GradientStops>
                <GradientStopCollection>
                    <GradientStop Color="#FFF" Offset="0.0"/>
                    <GradientStop Color="#CCC" Offset="1.0"/>
                </GradientStopCollection>
            </GradientBrush.GradientStops>
        </LinearGradientBrush>

        <!-- SimpleStyles: RadioButton -->
        <Style x:Key="{x:Type RadioButton}" TargetType="{x:Type RadioButton}">
            <Setter Property="SnapsToDevicePixels" Value="true"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="FocusVisualStyle"	Value="{StaticResource RadioButtonFocusVisual}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RadioButton}">
                        <BulletDecorator Background="Transparent">
                            <BulletDecorator.Bullet>
                                <Grid Width="20" 
                                    Height="20" >
                                    <Ellipse x:Name="Border"  
                                    Fill="{StaticResource NormalBrush}"
                                    StrokeThickness="1"
                                    Stroke="{StaticResource NormalBorderBrush}" />
                                    <Ellipse x:Name="CheckMark"
                                    Margin="5"
                                    Fill="{StaticResource GlyphBrush}" />
                                </Grid>
                            </BulletDecorator.Bullet>
                            <ContentPresenter/>
                        </BulletDecorator>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="false">
                                <Setter TargetName="CheckMark" Property="Visibility" Value="Collapsed"/>

                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>



        <ControlTemplate x:Key="rotLeft" TargetType="{x:Type Button}">
            <Grid>
                <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <Image  HorizontalAlignment="Left" Name="closeimg"  VerticalAlignment="Top"  Source="/iMagistic;component/images/rotateLeft.png" Stretch="None" />

            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/rotateLeftH.png" TargetName="closeimg"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/rotateLeftC.png" TargetName="closeimg"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>


        <ControlTemplate x:Key="rotRight" TargetType="{x:Type Button}">
            <Grid>
                <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <Image  HorizontalAlignment="Left" Name="closeimg"  VerticalAlignment="Top"  Source="/iMagistic;component/images/rotateRight.png" Stretch="None" />

            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/rotateRightH.png" TargetName="closeimg"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/rotateRightC.png" TargetName="closeimg"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <GeometryGroup x:Key="clipLocal" FillRule="EvenOdd" x:Name="clipRectMask">
            <!--
                в режиме EvenOdd фигуры при в областях перекрытия удаляют друг друга
                создаем два прямоугольника одного размера, т.е. площади двух фигур полностью пересекают друг друга,
                поэтому маска в начальном состоянии выходит пустой, т.е. ничего не маскируется
            -->
            <RectangleGeometry Rect="0,0,0,0"></RectangleGeometry>
            <RectangleGeometry Rect="0,0,0,0"></RectangleGeometry>
            <!--<RectangleGeometry Rect="350,250,40,40"></RectangleGeometry>-->
        </GeometryGroup>

        <Style x:Key="SpinnerImage" TargetType="{x:Type Image}">
            <Setter Property="RenderTransform">
                <Setter.Value>
                    <RotateTransform Angle="0" CenterX="16" CenterY="16" />
                </Setter.Value>
            </Setter>

            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="true">
                    <Trigger.EnterActions>
                        <BeginStoryboard>

                            <Storyboard Timeline.DesiredFrameRate="12">

                                <DoubleAnimation Storyboard.TargetProperty="RenderTransform.Angle"
                                        From="0" To="360" Duration="0:0:1" RepeatBehavior="Forever" />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                </Trigger>
            </Style.Triggers>
        </Style>

  
        <Style x:Key="imageListBoxStyle" TargetType="{x:Type ListBox}">
            <!-- Swap out the default items panel with a WrapPanel so that
           the images will be arranged with a different layout. -->
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <WrapPanel IsItemsHost="True" />
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="SimpleListBoxItem" TargetType="ListBoxItem">

            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Border   Name="Border"         
                                  BorderBrush="Black" 
                                  BorderThickness="2" 
                                  CornerRadius="4"
                                  Margin="6">
                            <Image Stretch="UniformToFill" Source="{Binding}"/>
                        </Border>
                        
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter TargetName="Border" Property="BorderBrush" Value="White"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
<!--!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->

        <ControlTemplate x:Key="settingsBtn" TargetType="{x:Type Button}">
            <Grid>

                <Image  HorizontalAlignment="Stretch" Name="closeimg"  VerticalAlignment="Stretch"  Source="/iMagistic;component/images/process.png" Stretch="None" />
                <Image  HorizontalAlignment="Left" VerticalAlignment="Center"  Source="/iMagistic;component/images/SETTINGS.png" Stretch="Uniform" Width="17" Height="17" Margin="10,1,0,0" />
                <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Margin="20,1,0,0" />
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/process_hover.png" TargetName="closeimg"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/process_click.png" TargetName="closeimg"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>





        <ControlTemplate x:Key="processBtn" TargetType="{x:Type Button}">
            <Grid>

                <Image  HorizontalAlignment="Stretch" Name="closeimg"  VerticalAlignment="Stretch"  Source="/iMagistic;component/images/process.png" Stretch="Fill" />
                <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/process_hover.png" TargetName="closeimg"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/process_click.png" TargetName="closeimg"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>


        <ControlTemplate x:Key="closeBtn" TargetType="{x:Type Button}">
                <Grid>
                     <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <Image  HorizontalAlignment="Left" Name="closeimg"  VerticalAlignment="Top"  Source="/iMagistic;component/images/close.png" Stretch="None" />
            </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/close_hover.png" TargetName="closeimg"/>
                    </Trigger>
                    <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/close_pressed.png" TargetName="closeimg"/>
                </Trigger>
                </ControlTemplate.Triggers>
        </ControlTemplate>
        
        <ControlTemplate x:Key="maxBtn" TargetType="{x:Type Button}">
            <Grid>
                <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <Image  HorizontalAlignment="Left" Name="closeimg"  VerticalAlignment="Top"  Source="/iMagistic;component/images/maximize.png" Stretch="None" />
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/maximize_hover.png" TargetName="closeimg"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/maximize_pressed.png" TargetName="closeimg"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <ControlTemplate x:Key="minBtn" TargetType="{x:Type Button}">
            <Grid>
                <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <Image  HorizontalAlignment="Left" Name="closeimg"  VerticalAlignment="Top"  Source="/iMagistic;component/images/minimize.png" Stretch="None" />

            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/minimize_hover.png" TargetName="closeimg"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Source" Value="/iMagistic;component/images/minimize_pressed.png" TargetName="closeimg"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <ControlTemplate x:Key="tabControl" TargetType="{x:Type TabControl}">
            <Grid KeyboardNavigation.TabNavigation="Local">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <TabPanel x:Name="HeaderPanel"
                    Grid.Row="0"
                    Panel.ZIndex="1"
                    Margin="0,0,4,-1"
                    IsItemsHost="True"
                    KeyboardNavigation.TabIndex="1"
                    Background="Transparent" />
                <Border x:Name="Border"
                  Grid.Row="1"
                  BorderThickness="0"
                  CornerRadius="2"
                  KeyboardNavigation.TabNavigation="Local"
                  KeyboardNavigation.DirectionalNavigation="Contained"
                  KeyboardNavigation.TabIndex="2">

                    <ContentPresenter x:Name="PART_SelectedContentHost"
                              Margin="4"
                              ContentSource="SelectedContent" />
                </Border>
            </Grid>
        </ControlTemplate>


        <ControlTemplate x:Key="menuBtn" TargetType="{x:Type Button}">
            <Grid Name="contentBtn">
                <ContentPresenter VerticalAlignment="Center"/>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="true">
                    <Setter Property="Background" TargetName="contentBtn">
                        <Setter.Value>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#45DD69FF" Offset="1" />
                                <GradientStop Color="Transparent" Offset="0" />
                            </LinearGradientBrush>
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="IsPressed" Value="true">
                    <Setter Property="Background" TargetName="contentBtn">
                        <Setter.Value>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#8FDD69FF" Offset="1" />
                                <GradientStop Color="Transparent" Offset="0" />
                            </LinearGradientBrush>
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <!--<Setter Property="Source" Value="/iMagistic;component/images/minimize_pressed.png" TargetName="closeimg"/>-->
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>


        <!--Brushes used in Styling of ScrollViewer-->

        <SolidColorBrush x:Key="StandardBorderBrush" Color="#888" />
        <SolidColorBrush x:Key="StandardBackgroundBrush" Color="#FFF" />
        <SolidColorBrush x:Key="HoverBorderBrush" Color="#DDD" />
        <SolidColorBrush x:Key="SelectedBackgroundBrush" Color="Gray" />
        <SolidColorBrush x:Key="SelectedForegroundBrush" Color="White" />
        <SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" />
       
       
        <LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
            <GradientBrush.GradientStops>
                <GradientStopCollection>
                    <GradientStop Color="#BBB" Offset="0.0"/>
                    <GradientStop Color="#EEE" Offset="0.1"/>
                    <GradientStop Color="#EEE" Offset="0.9"/>
                    <GradientStop Color="#FFF" Offset="1.0"/>
                </GradientStopCollection>
            </GradientBrush.GradientStops>
        </LinearGradientBrush>

        <!--SrollViewer ScrollBar Repeat Buttons (at each end)-->
        <Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                        <Border
                                                                  Name="Border"
                                                                  Margin="1"
                                                                  CornerRadius="2"
                                                                  Background="{StaticResource NormalBrush}"
                                                                  BorderBrush="{StaticResource NormalBorderBrush}"
                                                                  BorderThickness="1">
                            <Path
                                                            HorizontalAlignment="Center"
                                                            VerticalAlignment="Center"
                                                            Fill="{StaticResource GlyphBrush}"
                                                            Data="{Binding Path=Content,
                                                                RelativeSource={RelativeSource TemplatedParent}}" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsPressed" Value="true">
                                <Setter TargetName="Border" Property="Background"  Value="{StaticResource PressedBrush}" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!--SrollViewer ScrollBar Repeat Buttons (The part in the middle, 
                                        not the thumb, the long area between the buttons )-->
        <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="IsTabStop" Value="false"/>
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                        <Border Background="#5A5A5A" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!--ScrollViewer ScrollBar Thumb, that part that can be dragged
                                        up/down or left/right Buttons-->
        <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="IsTabStop" Value="false"/>
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Thumb}">
                        <Border
                                                      CornerRadius="2"
                                                      Background="#C9C9C9"
                                                      BorderBrush="{TemplateBinding BorderBrush}"
                                                      BorderThickness="1" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
            <Grid >
                <Grid.RowDefinitions>
                    <RowDefinition MaxHeight="18"/>
                    <RowDefinition Height="0.00001*"/>
                    <RowDefinition MaxHeight="18"/>
                </Grid.RowDefinitions>
                <Border
                                                      Grid.RowSpan="3"
                                                      CornerRadius="2"
                                                      Background="#D5D5D5" />
                <RepeatButton
                                                              Grid.Row="0"
                                                              Style="{StaticResource ScrollBarLineButton}"
                                                              Height="18"
                                                              Command="ScrollBar.LineUpCommand"
                                                              Content="M 0 4 L 8 4 L 4 0 Z" />
                <Track
                                                                  Name="PART_Track"
                                                                  Grid.Row="1"
                                                                  IsDirectionReversed="true">
                    <Track.DecreaseRepeatButton>
                        <RepeatButton
                                                                                  Style="{StaticResource ScrollBarPageButton}"
                                                                                  Command="ScrollBar.PageUpCommand" />
                    </Track.DecreaseRepeatButton>
                    <Track.Thumb>
                        <Thumb
                                                                          Style="{StaticResource ScrollBarThumb}"
                                                                          Margin="1,0,1,0"
                                                                          Background="{StaticResource HorizontalNormalBrush}"
                                                                          BorderBrush="{StaticResource HorizontalNormalBorderBrush}" />
                    </Track.Thumb>
                    <Track.IncreaseRepeatButton>
                        <RepeatButton
                                                                          Style="{StaticResource ScrollBarPageButton}"
                                                                          Command="ScrollBar.PageDownCommand" />
                    </Track.IncreaseRepeatButton>
                </Track>
                <RepeatButton
                                                                  Grid.Row="3"
                                                                  Style="{StaticResource ScrollBarLineButton}"
                                                                  Height="18"
                                                                  Command="ScrollBar.LineDownCommand"
                                                                  Content="M 0 0 L 4 4 L 8 0 Z"/>
            </Grid>
        </ControlTemplate>
        <!--HorizontalScrollBar Template using the previously created Templates-->
        <ControlTemplate x:Key="HorizontalScrollBar"
                                            TargetType="{x:Type ScrollBar}">
            <Grid >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MaxWidth="18"/>
                    <ColumnDefinition Width="0.00001*"/>
                    <ColumnDefinition MaxWidth="18"/>
                </Grid.ColumnDefinitions>
                <Border                                       Background="#5A5A5A"
                                                              Grid.ColumnSpan="3"
                                                              CornerRadius="2"
                                                               />
                <RepeatButton
                                                              Grid.Column="0"
                                                              Style="{StaticResource ScrollBarLineButton}"
                                                              Width="18"
                                                              Command="ScrollBar.LineLeftCommand"
                                                              Content="M 4 0 L 4 8 L 0 4 Z" />
                <Track
                                                                  Name="PART_Track"
                                                                  Grid.Column="1"
                                                                  IsDirectionReversed="False">
                    <Track.DecreaseRepeatButton>
                        <RepeatButton
                                                                      Style="{StaticResource ScrollBarPageButton}"
                                                                      Command="ScrollBar.PageLeftCommand" />
                    </Track.DecreaseRepeatButton>
                    <Track.Thumb>
                        <Thumb
                                                                          Style="{StaticResource ScrollBarThumb}"
                                                                          Margin="0,1,0,1"
                                                                          Background="{StaticResource NormalBrush}"
                                                                          BorderBrush="{StaticResource NormalBorderBrush}" />
                    </Track.Thumb>
                    <Track.IncreaseRepeatButton>
                        <RepeatButton
                                                                          Style="{StaticResource ScrollBarPageButton}"
                                                                          Command="ScrollBar.PageRightCommand" />
                    </Track.IncreaseRepeatButton>
                </Track>
                <RepeatButton
                                                              Grid.Column="3"
                                                              Style="{StaticResource ScrollBarLineButton}"
                                                              Width="18"
                                                              Command="ScrollBar.LineRightCommand"
                                                              Content="M 0 0 L 4 4 L 0 8 Z"/>
            </Grid>
        </ControlTemplate>
        <!--Style for overall  ScrollBar-->
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Style.Triggers>
                <Trigger Property="Orientation" Value="Horizontal">
                    <Setter Property="Width" Value="Auto"/>
                    <Setter Property="Height" Value="18" />
                    <Setter Property="Template"
                                                    Value="{StaticResource HorizontalScrollBar}" />
                </Trigger>
                <Trigger Property="Orientation" Value="Vertical">
                    <Setter Property="Width" Value="18"/>
                    <Setter Property="Height" Value="Auto" />
                    <Setter Property="Template"
                                                    Value="{StaticResource VerticalScrollBar}" />
                </Trigger>
            </Style.Triggers>
        </Style>

        <!--Style for overall  ScrollViewer-->
        <Style x:Key="FavsScrollViewer" TargetType="{x:Type ScrollViewer}">
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ScrollViewer}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <ScrollContentPresenter Grid.Column="1"/>

                            <ScrollBar Name="PART_VerticalScrollBar"
                                                                Value="{TemplateBinding VerticalOffset}"
                                                                Maximum="{TemplateBinding ScrollableHeight}"
                                                                ViewportSize="{TemplateBinding ViewportHeight}"
                                                                Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
                            <ScrollBar Name="PART_HorizontalScrollBar"
                                                                Orientation="Horizontal"
                                                                Grid.Row="1"
                                                                Grid.Column="1"
                                                                Value="{TemplateBinding HorizontalOffset}"
                                                                Maximum="{TemplateBinding ScrollableWidth}"
                                                                ViewportSize="{TemplateBinding ViewportWidth}"
                                                                Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>

                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
</Window.Resources>

 <!-- This ListBox is the Content of the Window. 
       Normally you would have a panel of some type
       as the Window's Content, but let's keep it simple. -->

      <Grid VerticalAlignment="Stretch"  Background="{x:Null}" HorizontalAlignment="Stretch" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="33">
                    </RowDefinition>
                    <RowDefinition Height="620*" MinHeight="595">
                    </RowDefinition>
                </Grid.RowDefinitions>

                <Grid Name="WindowBar" OpacityMask="{x:Null}"  MouseDown="WindowBar_MouseDown">
                    <Grid Name="WindowButtons" HorizontalAlignment="Right" VerticalAlignment="Top" >
                           <Button Height="22"  Margin="0,0,64,0" Template="{DynamicResource minBtn}" Width="31" HorizontalAlignment="Right" VerticalAlignment="Top" Click="MinimizeButtonClick" Background="{x:Null}" />
                           <Button Height="22"  Margin="0,0,32,0" Template="{DynamicResource maxBtn}" Width="31" HorizontalAlignment="Right" VerticalAlignment="Top" Click="MaximizeButtonClick" />
                           <Button Height="22" Width="31" Template="{DynamicResource closeBtn}"  Click="CloseButtonClick" HorizontalAlignment="Right" VerticalAlignment="Top" />           
                   
                    </Grid>
            <Grid Name="logotype" Height="33"  Width="139" HorizontalAlignment="Left" VerticalAlignment="Top">
                        <Image  Name="logoimg"  Source="/iMagistic;component/images/corner.png" MouseLeftButtonUp="logoimg_MouseLeftButtonUp" />
                    </Grid>
            <Grid.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#50FFFFFF" Offset="0" />
                            <GradientStop Color="#00000000" Offset="1" />
                        </LinearGradientBrush>
                    </Grid.Background>
                </Grid>

        <TabControl VerticalAlignment="Stretch" Template="{DynamicResource tabControl}" HorizontalAlignment="Stretch" Name="tabControl"  Grid.Row="1" Background="{x:Null}" Margin="0" >

            <TabItem Header="tabHome" Name="tabHome" IsEnabled="True" IsHitTestVisible="True" IsTabStop="False" IsSelected="True" Selector.IsSelected="False" Focusable="True" Visibility="Collapsed">
                <Grid>
                    <!--Home Layout Tab-->
                <local:PhotoLoader x:Name="photoLoader" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,-50,0,0" />
                    <Button Template="{DynamicResource settingsBtn}" Content="{x:Static res:Resources.settings}" Height="32" HorizontalAlignment="Right" Name="button3" VerticalAlignment="Bottom" Width="123" Margin="0,0,-3,20" FontSize="16" Foreground="White" OpacityMask="#7D000000" Click="button3_Click" />
                </Grid>
            </TabItem>

           <TabItem Header="tabEdit" Name="tabEdit" Padding="12,4" Margin="0" IsEnabled="True" IsHitTestVisible="True" IsTabStop="False" Selector.IsSelected="False" Focusable="True" Visibility="Collapsed" VerticalAlignment="Center">
                <!--Editing Layout Tab-->

                <Grid Name="EditLayout" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="{x:Null}" Margin="0" Grid.Row="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="430*"></RowDefinition>
                        <RowDefinition Height="30" />
                        <RowDefinition Height="120"></RowDefinition>
                    </Grid.RowDefinitions>


                    <Grid Name="imageBox" Margin="80,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Background="{x:Null}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="200*" />
                            <ColumnDefinition Width="80" MinWidth="80" />
                        </Grid.ColumnDefinitions>
                        <Grid Name="imageContainer" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Stretch" >
                            <Canvas Name="myCanvas"  Height="250" Width="350" Background="{x:Null}" SizeChanged="myCanvas_SizeChanged">
                                <!--картинку делаем неактивной, чтобы ее нельзя было тыкать IsHitTestVisible="False"-->
                                <Image Name="currentImage" Height="0" Width="0" Stretch="Fill" IsHitTestVisible="False"/>
                                <Rectangle x:Name="activeCropRectangle" Canvas.Left="0" Canvas.Top="0" Height="0" Stroke="White" Width="0" Fill="#00000000"/>
                                <Rectangle x:Name="rectForCrop" Fill="#80000000" 
                                   Height="0" Width="0" 
                                   Clip="{StaticResource clipLocal}" 
                                   IsHitTestVisible="False"/>
                                <local:SizeSelector x:Name="sizeSelector" OpacityMask="#E0000000" IsEnabled="True" Visibility="Hidden" />
                            </Canvas>

                            <!--<Image Name="currentImage"  Stretch="Uniform" StretchDirection="DownOnly" Width="700" Height="450" />-->

                        </Grid>
                        <Grid Grid.Column="1" Name="rotationGrid" HorizontalAlignment="Right" VerticalAlignment="Center" Visibility="Hidden" Height="269">
                            <Button IsHitTestVisible="True" Click="rotateLeftButtonClick" Template="{DynamicResource rotLeft}" Height="60" HorizontalAlignment="Right" Margin="0" Name="btnRotateLeft" VerticalAlignment="Top" Width="60" />
                            <Button IsHitTestVisible="True" Click="rotateRightButtonClick" Template="{DynamicResource rotRight}" Height="60" HorizontalAlignment="Left" Margin="0" Name="btnRotateRight" VerticalAlignment="Bottom" Width="60" />
                        </Grid>
                    </Grid>

                    <Grid Grid.Row="1" Name="imgDescription" VerticalAlignment="Top" HorizontalAlignment="Stretch">
                        <Label Content="{x:Static res:Resources.currentImageSize}" Height="30" HorizontalAlignment="Center" Name="label1" VerticalAlignment="Top" Foreground="#FFA7A7A7" FontSize="15" Padding="5" Margin="-85,0,0,0" />
                        <Label Content=" 10 X 15" FontSize="15" Foreground="#FFA7A7A7" Height="28"  HorizontalAlignment="Center" Margin="110,0,0,0" Name="imgSizeLabel" VerticalAlignment="Stretch" />
                        <Button Template="{DynamicResource processBtn}" Content="{x:Static res:Resources.process}" HorizontalAlignment="Right" Margin="0,0,-7,0" Name="processBtn" VerticalAlignment="Stretch" Width="143" FontSize="18" Foreground="#FFB3AFAF" FontWeight="Normal" FontFamily="Calibri" FontStyle="Normal" Click="processBtn_Click" />
                        <Button Content="{x:Static res:Resources.backToImport}" FontFamily="Calibri" FontSize="18" FontStyle="Normal" FontWeight="Normal" Foreground="#FFB3AFAF" HorizontalAlignment="Left" Margin="-7,0,0,0" Name="button2" Template="{DynamicResource processBtn}" VerticalAlignment="Stretch" Width="143" Click="backHomeBtn_Click" />
                    </Grid>

                    <Grid Grid.Row="2" VerticalAlignment="Stretch" Background="#21FFFFFF" HorizontalAlignment="Stretch" Margin="0,0,0,5" Height="100">
                        <ListBox ItemsSource="{Binding}" Style="{StaticResource imageListBoxStyle}" 
                                     Name="imageListCtrl" ItemContainerStyle="{StaticResource SimpleListBoxItem}" 
                                     Foreground="{x:Null}" BorderThickness="0" Background="{x:Null}" 
                                     ScrollViewer.VerticalScrollBarVisibility="Disabled" 
                                     ScrollViewer.HorizontalScrollBarVisibility="Visible" 
                                     HorizontalAlignment="Stretch" SelectionChanged="imageListCtrl_SelectionChanged" 
                                     Margin="10,0,10,0">
                        </ListBox>
                    </Grid>
                    <Image Name="spinner" Style="{DynamicResource ResourceKey=SpinnerImage}" Height="32" Width="32" Source="/iMagistic;component/images/preloader.gif" Margin="473,224,473,171" />
                </Grid>
            </TabItem>

            <TabItem Header="Settings" Visibility="Hidden">

                <Grid >

                    <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Width="635" Margin="0,-80,0,0" Height="453" Background="#1FFFF8F8" OpacityMask="{x:Null}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="47" />
                            <RowDefinition Height="261" />
                            <RowDefinition Height="145*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="271" />
                            <ColumnDefinition Width="350" />
                            <ColumnDefinition Width="0*" />
                            <ColumnDefinition Width="14*" />
                        </Grid.ColumnDefinitions>
                        <Label Content="{x:Static res:Resources.language}"  Height="50" HorizontalAlignment="Right" Name="label2" VerticalAlignment="Top" Padding="0" Foreground="White" FontSize="24" Margin="0,-8,22,0" VerticalContentAlignment="Bottom" HorizontalContentAlignment="Right" FontFamily="Arial" />
                        <ComboBox Grid.Column="1" Height="35" HorizontalAlignment="Left" Margin="6,12,0,0" Name="languageSelector" VerticalAlignment="Top" Width="330" FontSize="20" SelectedIndex="0" SelectionChanged="languageSelector_SelectionChanged">
                            <ComboBoxItem Content=" English" FontSize="20" />
                            <ComboBoxItem Content=" Romanian" />
                        </ComboBox>
                        <Label Content="{x:Static res:Resources.defaultSize}" FontFamily="Arial" FontSize="24" Foreground="White" Height="50" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Name="label3" Padding="0" VerticalAlignment="Top" VerticalContentAlignment="Bottom" Grid.Row="1" Margin="0,15,22,0" />
                        <GroupBox Grid.Column="1" Grid.Row="1" Header="" HorizontalAlignment="Left" Name="groupBox1" BorderThickness="0" Width="338">
                            <Grid Height="248" VerticalAlignment="Top" HorizontalAlignment="Stretch" Width="332">
                                <RadioButton Height="22" HorizontalAlignment="Left" Margin="6,28,0,0" Name="radioButton1" VerticalAlignment="Top" Width="31" />
                                <RadioButton Height="22" HorizontalAlignment="Left" Margin="6,75,0,0" Name="radioButton2" VerticalAlignment="Top" Width="31" IsChecked="True" />
                                <RadioButton Height="22" HorizontalAlignment="Left" Margin="6,124,0,0" Name="radioButton3" VerticalAlignment="Top" Width="31" />
                                <RadioButton Height="22" HorizontalAlignment="Left" Margin="6,171,0,0" Name="radioButton4" VerticalAlignment="Top" Width="31" />
                                <RadioButton Height="22" HorizontalAlignment="Left" Margin="6,219,0,0" Name="radioButton5" VerticalAlignment="Top" Width="31" />
                                <Label Content="9 X 13" FontFamily="Arial" FontSize="26" Foreground="White" Height="50" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Margin="0,3,187,0" Name="label5" Padding="0" VerticalAlignment="Top" VerticalContentAlignment="Bottom" />
                                <Label Content="10 X 15" FontFamily="Arial" FontSize="26" Foreground="White" Height="50" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Margin="0,50,187,0" Name="label6" Padding="0" VerticalAlignment="Top" VerticalContentAlignment="Bottom" />
                                <Label Content="13 X 18" FontFamily="Arial" FontSize="26" Foreground="White" Height="50" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Margin="0,99,187,0" Name="label7" Padding="0" VerticalAlignment="Top" VerticalContentAlignment="Bottom" />
                                <Label Content="15 X 21" FontFamily="Arial" FontSize="26" Foreground="White" Height="50" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Margin="0,146,187,0" Name="label8" Padding="0" VerticalAlignment="Top" VerticalContentAlignment="Bottom" />
                                <Label Content="20 X 30" FontFamily="Arial" FontSize="26" Foreground="White" Height="50" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Margin="0,194,187,0" Name="label9" Padding="0" VerticalAlignment="Top" VerticalContentAlignment="Bottom" />
                            </Grid>
                        </GroupBox>
                        <Label Content="{x:Static res:Resources.outputDirectory}" FontFamily="Arial" FontSize="24" Foreground="White" Height="50" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Name="label4" Padding="0" VerticalAlignment="Top" VerticalContentAlignment="Bottom" Grid.Row="2" Margin="0,0,22,0" />
                        <RadioButton Height="22" HorizontalAlignment="Left" Margin="12,28,0,0" Name="radioButton6" VerticalAlignment="Top" Width="31" Grid.Column="1" Grid.Row="2" />
                        <RadioButton Height="22" HorizontalAlignment="Left" Margin="12,77,0,0" Name="radioButton7" VerticalAlignment="Top" Width="31" Grid.Column="1" Grid.Row="2" IsChecked="True" IsThreeState="True" Click="radioButton7_Click" />
                        <Label Content="{x:Static res:Resources.sameAsSource}" FontFamily="Arial" FontSize="24" Foreground="White" Height="50" HorizontalAlignment="Left" HorizontalContentAlignment="Left" Name="label10" Padding="0" VerticalAlignment="Top" VerticalContentAlignment="Bottom" Grid.Column="1" Grid.Row="2" Width="289" Margin="61,0,0,0" Grid.ColumnSpan="3" />
                        <Label Content="{x:Static res:Resources.custom}" FontFamily="Arial" FontSize="24" Foreground="White" Grid.ColumnSpan="3" Height="50" HorizontalAlignment="Left" HorizontalContentAlignment="Left" Margin="61,50,0,0" Name="label11" Padding="0" VerticalAlignment="Top" VerticalContentAlignment="Bottom" Width="289" Grid.Column="1" Grid.Row="2" />
                        <Label Content="( D:\iMagistic )" FontFamily="Arial" FontSize="16" Foreground="White" Height="26" HorizontalAlignment="Left" HorizontalContentAlignment="Left" Margin="61,106,0,0" Name="label12" Padding="0" VerticalAlignment="Top" VerticalContentAlignment="Top" Width="277" Grid.Column="1" Grid.Row="2" FontStyle="Italic" />
                    </Grid>
                    <Button Template="{DynamicResource processBtn}" Content="{x:Static res:Resources.apply}" Height="42" HorizontalAlignment="Center" Margin="0,450,0,0" Name="button4" VerticalAlignment="Center" Width="153" FontSize="20" Foreground="White" Click="applyBtn_Click" />
                </Grid>

            </TabItem>
            
            <TabItem Header="Saving" Visibility="Hidden">
                <Grid >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="388" />
                        <ColumnDefinition Width="582*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="116*" />
                        <RowDefinition Height="339*" />
                        <RowDefinition Height="118*" />
                    </Grid.RowDefinitions>
                    <Label Content="{x:Static res:Resources.processing}" Height="99" HorizontalAlignment="Left" Margin="134,0,0,0" Name="saveHeader" VerticalAlignment="Bottom" Foreground="White" FontSize="72" Width="626" OpacityMask="#4B000000" FontFamily="Calibri" VerticalContentAlignment="Top" Grid.ColumnSpan="2" Padding="0" />


                    <Border Width="225" BorderThickness="5" BorderBrush="#FFB5B5B5" Margin="0,53,23,0" Height="155" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Top">
                        <Image Height="150" HorizontalAlignment="Left"  Name="processingImage" Stretch="UniformToFill" VerticalAlignment="Top" Width="220" StretchDirection="Both" />
                    </Border>
                    
                    <Label Content="XX" Height="40" HorizontalAlignment="Left" Margin="11,149,0,0" Name="currentIdxLabel" VerticalAlignment="Top" Width="64" Foreground="White" FontSize="24" Grid.Row="1" Grid.Column="1" />
                    <Label Content="{x:Static res:Resources.outOf}" FontSize="20" Foreground="White" Height="40" HorizontalAlignment="Left" Margin="56,153,0,0" Name="outOfLbl" VerticalAlignment="Top" Width="64" Grid.Row="1" Grid.Column="1" />
                    <Label Content="YY" FontSize="24" Foreground="White" Height="40" HorizontalAlignment="Right" Margin="0,149,392,0" Name="totalIdxLabel" VerticalAlignment="Top" Width="64" Grid.Row="1" Grid.Column="1" />
                    <Label Content="{x:Static res:Resources.savingImagesTo}" FontSize="28" Foreground="White" Height="45" HorizontalAlignment="Left" Margin="9,45,0,0" Name="info1" VerticalAlignment="Top" Width="545" Grid.Row="1" Grid.Column="1" />
                    <Image local:ImageBehavior.AnimatedSource="/Images/spinner.gif"  Height="19" HorizontalAlignment="Left" Margin="11,192,0,0" Name="savingSpinner" Stretch="Fill" VerticalAlignment="Top" Width="205" Grid.Row="1" Grid.Column="1" />
                    <Label Content="C:/Documents and Settings/Users/Victor/iMagistic" FontSize="16" Foreground="#FF6F6C6C" Height="43" HorizontalAlignment="Left" Margin="11,88,0,0" Name="savingPathLbl" VerticalAlignment="Top" Width="419" Grid.Row="1" Grid.Column="1" />

                    <Grid Background="#38FFFFFF" Grid.Row="2" Grid.ColumnSpan="2">
                        
                    </Grid>
                    <Button Content="{x:Static res:Resources.cancel}" FontSize="16" Foreground="#FFCECECE" Height="58" HorizontalAlignment="Left" Margin="248,153,0,0" Name="cancelBtn" Template="{DynamicResource processBtn}" VerticalAlignment="Top" Width="124" Grid.Column="1" Grid.Row="1" OpacityMask="#BE000000" Click="Cancel_Click" />
                    <Button Content="{x:Static res:Resources.backToHomeScreen}" FontSize="16" Foreground="#FFCECECE" Height="58" HorizontalAlignment="Left" Margin="114,143,0,0" Name="backHomeBtn" OpacityMask="#BE000000" Template="{DynamicResource processBtn}" VerticalAlignment="Top" Width="177" Grid.Column="1" Grid.Row="1" Visibility="Hidden" Click="backHomeBtn_Click_1" />
                    <Label Content="{x:Static res:Resources.finished}" FontFamily="Calibri" FontSize="72" Foreground="White" Grid.ColumnSpan="2" Height="99" HorizontalAlignment="Left" Margin="134,0,0,0" Name="finishedLbl" OpacityMask="#4B000000" Padding="0" VerticalAlignment="Bottom" VerticalContentAlignment="Top" Width="626" Visibility="Hidden" />
                    <Label Content="{x:Static res:Resources.allImagesHaveBeenSavedTo}" FontSize="28" Foreground="White" Height="45" HorizontalAlignment="Left" Margin="9,45,0,0" Name="info2" VerticalAlignment="Top" Width="545" Grid.Column="1" Grid.Row="1" Visibility="Hidden" />
                </Grid>
            </TabItem>


        </TabControl>
    </Grid>

    
    
</Window>